package owl2vowl.parser.helper;

public class IriFormatText {
	public static String cutQuote(String cuttingObject) {
		if (cuttingObject == null) {
			return null;
		} else {
			int firstIndex = cuttingObject.indexOf("\"");
			int lastIndex = cuttingObject.lastIndexOf("\"");
			return firstIndex != -1 && firstIndex != lastIndex
					? cuttingObject.substring(firstIndex + 1, lastIndex)
					: cuttingObject;
		}
	}

	public static String extractNameFromIRI(String iri) {
		String name;
		if (iri.contains("#")) {
			name = iri.substring(iri.indexOf("#") + 1);
		} else if (iri.contains("/")) {
			name = iri.substring(iri.lastIndexOf("/") + 1);
		} else {
			name = "";
		}

		return name;
	}
}